Loading TOC...

POST /manage/v2/databases/{id|name}/sub-databases

Summary

Create a new database attached as sub-database of the database identified by {id|name}.

Request Headers
Content-type The MIME type of the data in the request body. Supported values: application/xml, application/json.
Response Headers
Location A reference to the newly created database, suitable for retrieving configuration and status information using the Management API. For example, if a requests creates a database named "subdb": /manage/v2/databases/15326391285115269194/sub-databases/subdb.

Response

Upon success, MarkLogic server returns status code 201 (Created).

Required Privileges

This operation requires the manage-admin role, or the following privilege:

http://marklogic.com/xdmp/privileges/manage-admin

Usage Notes

You can set the kind element of the input configuration to either active or archive.

For details, see tieredstorage:database-create-sub-database and Sub-databases and Super-databases in the Administrator's Guide.

The structure of the data in the request body is as follows:

database-name

The database name.

kind

The kind of sub-database (active, archive).

Example


$ cat subdb-create.xml
==> 
<sub-database xmlns="http://marklogic.com/manage">
  <database-name>sub-1</database-name>
  <kind>active</kind>
</sub-database>

$ curl --anyauth --user user:password -X POST -d @./subdb-create.xml \
    -i -H "Content-type: application/xml" \
    http://localhost:8002/manage/v2/databases/super-db/sub-databases

==> Create a database named sub-1 and make a sub-database of super-db.
    MarkLogic Server responds with status code 201 (Created) and headers
    similar to the following:

HTTP/1.1 201 Created
Content-type: application/xml
Cache-Control: no-cache
Expires: -1
Server: MarkLogic
Content-Length: 0
Connection: Keep-Alive
Keep-Alive: timeout=5
    

Example


$ cat subdb-create.json
==> 
{
  "database-name": "sub-1",
  "kind": "active"
}

$ curl --anyauth --user user:password -X POST -d @./subdb-create.json \
    -i -H "Content-type: application/json" \
    http://localhost:8002/manage/v2/databases/super-db/sub-databases

==> Create a database named sub-1 and make a sub-database of super-db.
    MarkLogic Server responds with status code 201 (Created) and headers
    similar to the following:

HTTP/1.1 201 Created
Content-type: application/xml
Cache-Control: no-cache
Expires: -1
Server: MarkLogic
Content-Length: 0
Connection: Keep-Alive
Keep-Alive: timeout=5
    

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.